let apiUrl = 'http://localhost:3000';
let token = localStorage.getItem('token') || '';
function myajax({ url, type = 'get', data = null, dataType = '' }) {
    return new Promise((resolve, reject) => {
        $.ajax({
            url: apiUrl + url,
            type,
            data,
            dataType,
            headers: {
                authorization: token,
            },
            success(res) {
                resolve([null, res]);
            },
            error(err) {
                resolve([err, null]);
            }
        })
    })
}